From: Jeroen van der Heijden Date: Thu, 3 Jan 2019 13:35:05 +0000 (+0100) Subject: Removed some not required void* casts X-Git-Tag: archive/raspbian/2.0.44-1+rpi1~1^2~3^2~7^2~2^2~16 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=80caefcf68fd60adb412cef487299da6ce9904ea;p=siridb-server.git Removed some not required void* casts --- diff --git a/src/siri/db/fifo.c b/src/siri/db/fifo.c index e6c06902..10b7b01b 100644 --- a/src/siri/db/fifo.c +++ b/src/siri/db/fifo.c @@ -26,7 +26,7 @@ static int FIFO_init(siridb_fifo_t * fifo); */ siridb_fifo_t * siridb_fifo_new(siridb_t * siridb) { - siridb_fifo_t * fifo = (siridb_fifo_t *) malloc(sizeof(siridb_fifo_t)); + siridb_fifo_t * fifo = malloc(sizeof(siridb_fifo_t)); if (fifo == NULL) { diff --git a/src/siri/db/forward.c b/src/siri/db/forward.c index c63706cd..b375b5ed 100644 --- a/src/siri/db/forward.c +++ b/src/siri/db/forward.c @@ -19,7 +19,7 @@ siridb_forward_t * siridb_forward_new(siridb_t * siridb) { uint16_t size = siridb->pools->len; - siridb_forward_t * forward = (siridb_forward_t *) malloc( + siridb_forward_t * forward = malloc( sizeof(siridb_forward_t) + size * sizeof(qp_packer_t *)); if (forward == NULL) diff --git a/src/siri/db/groups.c b/src/siri/db/groups.c index cc2916c8..16fe0049 100644 --- a/src/siri/db/groups.c +++ b/src/siri/db/groups.c @@ -63,8 +63,7 @@ siridb_groups_t * siridb_groups_new(siridb_t * siridb) { log_info("Loading groups"); - siridb_groups_t * groups = - (siridb_groups_t *) malloc(sizeof(siridb_groups_t)); + siridb_groups_t * groups = malloc(sizeof(siridb_groups_t)); if (groups == NULL) { ERR_ALLOC diff --git a/src/siri/db/initsync.c b/src/siri/db/initsync.c index 4dd9e604..771dcbe9 100644 --- a/src/siri/db/initsync.c +++ b/src/siri/db/initsync.c @@ -47,8 +47,7 @@ static char sync_progress[30]; */ siridb_initsync_t * siridb_initsync_open(siridb_t * siridb, int create_new) { - siridb_initsync_t * initsync = - (siridb_initsync_t *) malloc(sizeof(siridb_initsync_t)); + siridb_initsync_t * initsync = malloc(sizeof(siridb_initsync_t)); if (initsync == NULL) { ERR_ALLOC @@ -74,8 +73,7 @@ siridb_initsync_t * siridb_initsync_open(siridb_t * siridb, int create_new) } else { - initsync->next_series_id = - (uint32_t *) malloc(sizeof(uint32_t)); + initsync->next_series_id = malloc(sizeof(uint32_t)); if (initsync->next_series_id == NULL) { ERR_ALLOC diff --git a/src/siri/db/insert.c b/src/siri/db/insert.c index e8f1eebe..198bcaa6 100644 --- a/src/siri/db/insert.c +++ b/src/siri/db/insert.c @@ -199,7 +199,7 @@ siridb_insert_t * siridb_insert_new( uint16_t pid, sirinet_stream_t * client) { - siridb_insert_t * insert = (siridb_insert_t *) malloc( + siridb_insert_t * insert = malloc( sizeof(siridb_insert_t) + siridb->pools->len * sizeof(qp_packer_t *)); @@ -258,7 +258,7 @@ siridb_insert_t * siridb_insert_new( */ int siridb_insert_points_to_pools(siridb_insert_t * insert, size_t npoints) { - uv_async_t * handle = (uv_async_t *) malloc(sizeof(uv_async_t)); + uv_async_t * handle = malloc(sizeof(uv_async_t)); if (handle == NULL) { ERR_ALLOC @@ -456,7 +456,7 @@ static void INSERT_local_free_cb(uv_async_t * handle) if (ilocal->forward != NULL) { - uv_async_t * fwd = (uv_async_t *) malloc(sizeof(uv_async_t)); + uv_async_t * fwd = malloc(sizeof(uv_async_t)); if (fwd == NULL || siri_err) { if (fwd == NULL) @@ -1005,16 +1005,14 @@ static int INSERT_init_local( sirinet_pkg_t * pkg, uint8_t flags) { - sirinet_promise_t * promise = - (sirinet_promise_t *) malloc(sizeof(sirinet_promise_t)); + sirinet_promise_t * promise = malloc(sizeof(sirinet_promise_t)); if (promise == NULL) { free(pkg); ERR_ALLOC return -1; } - siridb_insert_local_t * ilocal = - (siridb_insert_local_t *) malloc(sizeof(siridb_insert_local_t)); + siridb_insert_local_t * ilocal = malloc(sizeof(siridb_insert_local_t)); if (ilocal == NULL) { free(pkg); @@ -1023,7 +1021,7 @@ static int INSERT_init_local( return -1; } - uv_async_t * handle = (uv_async_t *) malloc(sizeof(uv_async_t)); + uv_async_t * handle = malloc(sizeof(uv_async_t)); if (handle == NULL) { free(pkg); diff --git a/src/siri/db/median.c b/src/siri/db/median.c index a5da036b..346781ea 100644 --- a/src/siri/db/median.c +++ b/src/siri/db/median.c @@ -55,8 +55,7 @@ int siridb_median_find_n( { int64_t pivot, v; - int64_t * arr_l = - (int64_t *) malloc(sizeof(int64_t) * 2 * (points->len - 1)); + int64_t * arr_l = malloc(sizeof(int64_t) * 2 * (points->len - 1)); if (arr_l == NULL) { @@ -111,8 +110,7 @@ int siridb_median_find_n( { double pivot, v; - double * arr_l = - (double *) malloc(sizeof(double) * 2 * (points->len - 1)); + double * arr_l = malloc(sizeof(double) * 2 * (points->len - 1)); if (arr_l == NULL) { @@ -186,8 +184,7 @@ int siridb_median_real( { int64_t pivot, v, a, b; - int64_t * arr_l = - (int64_t *) malloc(sizeof(int64_t) * 2 * (points->len - 1)); + int64_t * arr_l = malloc(sizeof(int64_t) * 2 * (points->len - 1)); if (arr_l == NULL) { @@ -263,8 +260,7 @@ int siridb_median_real( { double pivot, v, a, b; - double * arr_l = - (double *) malloc(sizeof(double) * 2 * (points->len - 1)); + double * arr_l = malloc(sizeof(double) * 2 * (points->len - 1)); if (arr_l == NULL) { diff --git a/src/siri/db/pcache.c b/src/siri/db/pcache.c index fe99bca5..f45dcd72 100644 --- a/src/siri/db/pcache.c +++ b/src/siri/db/pcache.c @@ -15,8 +15,7 @@ */ siridb_pcache_t * siridb_pcache_new(points_tp tp) { - siridb_pcache_t * pcache = - (siridb_pcache_t *) malloc(sizeof(siridb_pcache_t)); + siridb_pcache_t * pcache = malloc(sizeof(siridb_pcache_t)); if (pcache == NULL) { ERR_ALLOC @@ -26,9 +25,7 @@ siridb_pcache_t * siridb_pcache_new(points_tp tp) pcache->size = PCACHE_DEFAULT_SIZE; pcache->len = 0; pcache->tp = tp; - pcache->data = (siridb_point_t *) malloc( - sizeof(siridb_point_t) * PCACHE_DEFAULT_SIZE); - + pcache->data = malloc(sizeof(siridb_point_t) * PCACHE_DEFAULT_SIZE); if (pcache->data == NULL) { ERR_ALLOC @@ -52,10 +49,9 @@ int siridb_pcache_add_point( { if (pcache->len == pcache->size) { + siridb_point_t * tmp; pcache->size *= 2; - siridb_point_t * tmp = (siridb_point_t *) realloc( - pcache->data, - sizeof(siridb_point_t) * pcache->size); + tmp = realloc(pcache->data, sizeof(siridb_point_t) * pcache->size); if (tmp == NULL) { log_error( diff --git a/src/siri/db/points.c b/src/siri/db/points.c index caf842d4..18788724 100644 --- a/src/siri/db/points.c +++ b/src/siri/db/points.c @@ -117,7 +117,7 @@ siridb_points_t * siridb_points_copy(siridb_points_t * points) size_t sz = sizeof(siridb_point_t) * points->len; cpoints->len = points->len; cpoints->tp = points->tp; - cpoints->data = (siridb_point_t *) malloc(sz); + cpoints->data = malloc(sz); if (cpoints->data == NULL) { free(cpoints); @@ -457,7 +457,7 @@ unsigned char * siridb_points_zip_int( *cinfo <<= 8; *cinfo |= tcount | (shift << 4); *size = 16 + shift - tcount + (tcount + vcount) * (end - start - 1); - bits = (unsigned char *) malloc(*size); + bits = malloc(*size); if (bits == NULL) { return NULL; @@ -528,7 +528,7 @@ unsigned char * siridb_points_zip_string( *size = sizeof(uint64_t); return siridb_points_raw_string(points, start, end, cinfo, size); } - size_t * sizes = (size_t *) malloc(sizeof(size_t) * n); + size_t * sizes = malloc(sizeof(size_t) * n); if (sizes == NULL) { return NULL; @@ -578,8 +578,8 @@ unsigned char * siridb_points_zip_string( /* calculate time-stamps size */ sz = 13 + shift + tinfo*(n - 2); - src = (uint8_t *) malloc(sz_src); - out = (uint8_t *) malloc(sz + sz_src + (is_ascii ? 0 : (n * 8))); + src = malloc(sz_src); + out = malloc(sz + sz_src + (is_ascii ? 0 : (n * 8))); if (src == NULL || out == NULL) { goto failed; @@ -659,7 +659,7 @@ unsigned char * siridb_points_raw_string( *size = 0; uint_fast32_t n = end - start; - size_t * sizes = (size_t *) malloc(sizeof(size_t) * n); + size_t * sizes = malloc(sizeof(size_t) * n); size_t * psz = sizes; unsigned char * pdata; unsigned char * cdata; @@ -784,7 +784,7 @@ unsigned char * siridb_points_zip_double( *cinfo <<= 8; *cinfo |= tcount | (shift << 4); *size = 16 + shift - tcount + (tcount + vcount) * (end - start - 1); - bits = (unsigned char *) malloc(*size); + bits = malloc(*size); if (bits == NULL) { return NULL; @@ -1177,7 +1177,7 @@ int siridb_points_unzip_string( memcpy(&point->ts, pt, sizeof(uint64_t)); pt += sizeof(uint64_t); - buf = (uint8_t *) malloc(src_sz); + buf = malloc(src_sz); if (buf == NULL) { return -1; @@ -1276,7 +1276,7 @@ static unsigned char * POINTS_zip_raw( *size = n * 16; *cinfo = 0xffff; - bits = (unsigned char *) malloc(*size); + bits = malloc(*size); if (bits == NULL) { return NULL; diff --git a/src/siri/db/presuf.c b/src/siri/db/presuf.c index 4800798d..4de324ca 100644 --- a/src/siri/db/presuf.c +++ b/src/siri/db/presuf.c @@ -67,8 +67,7 @@ siridb_presuf_t * siridb_presuf_add( switch (ps_children->node->cl_obj->gid) { case CLERI_GID_K_PREFIX: - nps->prefix = - (char *) malloc(ps_children->next->node->len + 1); + nps->prefix = malloc(ps_children->next->node->len + 1); if (nps->prefix != NULL) { /* not critical if suffix is still NULL */ @@ -79,8 +78,7 @@ siridb_presuf_t * siridb_presuf_add( } break; case CLERI_GID_K_SUFFIX: - nps->suffix = - (char *) malloc(ps_children->next->node->len + 1); + nps->suffix = malloc(ps_children->next->node->len + 1); if (nps->suffix != NULL) { /* not critical if suffix is still NULL */ @@ -153,8 +151,7 @@ const char * siridb_presuf_name( */ siridb_presuf_t * PRESUF_add(siridb_presuf_t ** presuf) { - siridb_presuf_t * newps = - (siridb_presuf_t *) malloc(sizeof(siridb_presuf_t)); + siridb_presuf_t * newps = malloc(sizeof(siridb_presuf_t)); if (newps == NULL) { ERR_ALLOC diff --git a/src/siri/db/reindex.c b/src/siri/db/reindex.c index afebf0ff..d85e94c2 100644 --- a/src/siri/db/reindex.c +++ b/src/siri/db/reindex.c @@ -66,8 +66,7 @@ static char reindex_progress[30]; */ siridb_reindex_t * siridb_reindex_open(siridb_t * siridb, int create_new) { - siridb_reindex_t * reindex = - (siridb_reindex_t *) malloc(sizeof(siridb_reindex_t)); + siridb_reindex_t * reindex = malloc(sizeof(siridb_reindex_t)); if (reindex == NULL) { ERR_ALLOC @@ -127,8 +126,7 @@ siridb_reindex_t * siridb_reindex_open(siridb_t * siridb, int create_new) } else if (reindex->size) { - reindex->next_series_id = - (uint32_t *) malloc(sizeof(uint32_t)); + reindex->next_series_id = malloc(sizeof(uint32_t)); if (reindex->next_series_id == NULL) { @@ -147,8 +145,7 @@ siridb_reindex_t * siridb_reindex_open(siridb_t * siridb, int create_new) } else { - reindex->timer = - (uv_timer_t *) malloc(sizeof(uv_timer_t)); + reindex->timer = malloc(sizeof(uv_timer_t)); if (reindex->timer == NULL) { ERR_ALLOC diff --git a/src/siri/db/series.c b/src/siri/db/series.c index d7e9e54b..3d6d12b8 100644 --- a/src/siri/db/series.c +++ b/src/siri/db/series.c @@ -1317,8 +1317,7 @@ static siridb_series_t * SERIES_new( const char * name) { uint32_t n; - siridb_series_t * series; - series = (siridb_series_t *) malloc(sizeof(siridb_series_t)); + siridb_series_t * series = malloc(sizeof(siridb_series_t)); if (series == NULL) { ERR_ALLOC @@ -1473,7 +1472,7 @@ static int SERIES_read_dropped(siridb_t * siridb, imap_t * dropped) else if (size) { - buffer = (char *) malloc(size); + buffer = malloc(size); if (buffer == NULL) { log_critical("Cannot allocate buffer for reading dropped series");